package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCUtil {
	private static String url = "jdbc:mysql://titan.cmpe.boun.edu.tr:3306/database8";
	
	 static {
		try {
            DriverManager.registerDriver(new com.mysql.jdbc.Driver());
        } catch (SQLException e) {
            System.out.println("Problem with driver!"+ e.getMessage());
        }
	}
	public static void closeConnection(Connection c){
		try {
			c.close();
		} catch (SQLException e) {
			System.out.println("Problem with ending the connection!");
		}
	}
	public static Connection getConnection() {
		Connection conn=null;
		try {
            conn = DriverManager.getConnection(url, "project8", "Tz1VsO");
        } catch (SQLException e) {
            System.out.println("Problem with connection!" + e.getMessage());
        }
		return conn;
	}
}